<!--岗位选择器-->
<!--将岗位以及等级进行组合-->
<template>
  <el-cascader
    :options="options"
    :props="props"
    v-bind="$attrs"
    v-on="$listeners"
  >
  </el-cascader>
</template>

<script>
import {listPost} from '@/api/system/post'

export default {
  name: "PostLevelSelector",
  dicts: ['post_level'],
  data() {
    return {
      value: [],
      options: [],
      props: { multiple: true },
    }
  },
  methods: {
    onDictReady(dict) {
      const levels = dict.type.post_level.map(e => {
        return {
          label: e.label,
          value: e.value
        }
      })
      listPost().then(response => {
        response.rows.forEach(post => {
          this.options.push({label: post.postName, value: post.postId, children: levels})
        })
      })
    }
  },
  created() {
  }
}
</script>

<style scoped>

</style>
